#include #include #include #include "misc/CMSTypes.h" #include "LCD/LCD_LMG6381.h" #include "GPS/GPS.h" #include "MMC/MMC.h" #define DB_LED(state) { DDRB = 0xff; PORTB = ~(1< Device starting...\n" ); LCDC_Print( "> Accessing MMC Card..." ); BYTE ret = MMC_Init( MMC_SPEED_EXTREME ); if ( ret != MMC_OK ) { if ( ret == MMC_FAILED_NOCARD ) LCDC_Print( " FAILED: No card detected!\n" ); else if ( ret == MMC_FAILED_TIMEOUT ) LCDC_Print( " FAILED: Timeout!\n" ); else LCDC_Print( " FAILED ?!!!\n" ); return 0; } LCDC_Print( " OK!\n" ); BYTE abyB[ 512 ]; LCDC_Print( "> Writing Sector..." ); ret |= MMC_Write_Open( 1 ); abyB[0] = (BYTE)2; ret |= MMC_Write_Data( &abyB[0],1 ); ret |= MMC_Write_Close(); if ( ret != MMC_OK ) { if ( ret == MMC_FAILED_TIMEOUT ) LCDC_Print( " FAILED: Timeout!\n" ); else if ( ret == MMC_FAILED ) LCDC_Print( " FAILED: FAILED!\n" ); else LCDC_Print( " FAILED ?!!!\n" ); return 0; } LCDC_Print( " OK!\n" ); LCDC_Print( "> Reading Sector..." ); ret = MMC_ReadSector( abyB, 1 ); if ( ret != MMC_OK ) { if ( ret == MMC_FAILED_TIMEOUT ) LCDC_Print( " FAILED: Timeout!\n" ); else if ( ret == MMC_FAILED ) LCDC_Print( " FAILED: FAILED!\n" ); else LCDC_Print( " FAILED ?!!!\n" ); return 0; } LCDC_Print( " OK!\n" ); char buf[10]; for ( WORD i=0; i<512; i++ ) { if ( abyB[i] ) { sprintf( buf, "%d:[%x]", i, abyB[i] ); LCDC_Print( buf ); } } LCDC_Print( "> Test END!\n" ); return 0; }